<div>
  <div class="pull-right">
    <%= form_tag admin_product_case_product_case_attachments_path(product_case_id: @product_case), method: :post, enctype: "multipart/form-data", class: "form-horizontal" do %>
      <input type="file" name="image" multiple class="image-input" />
      <%= submit_tag "上传", class: "btn btn-primary" %>
    <% end -%>
  </div>

  <h1>
    商品案例图片 #<%= @product_case.id %> <%= @product_case.title %>
  </h1>
</div>

<div>
  <table class="table table-striped">
    <tr>
      <th>ID</th>
      <th>图片</th>
      <th>权重</th>
      <th></th>
    </tr>

    <% @product_case_attachments.each do |product_case_attachment| %>
      <tr>
        <td><%= product_case_attachment.id %></td>
        <td><%= image_tag product_case_attachment.image_url(:thumb), style: 'width: 200px;height:200px;' %></td>
        <td>
          <%= form_tag admin_product_case_product_case_attachment_path(@product_case, product_case_attachment), method: :put do %>
            <input type="text" value="<%= product_case_attachment.weight %>" name="weight" />
            <%= submit_tag "更新", class: "btn btn-default btn-xs" %>
          <% end -%>
        </td>
        <td align="right">
          <%= link_to "删除", admin_product_case_product_case_attachment_path(@product_case, product_case_attachment), method: :delete, 'data-confirm': "确认删除吗?" %>
        </td>
      </tr>
    <% end -%>
  </table>

</div>

